import type { RouteRecordRaw } from 'vue-router'

/**
 * 路由配置
 * @description 所有路由都在这里集中管理
 */
const routes: RouteRecordRaw[] = [
  /**
   * 首页
   */
  {
    path: '/',
    redirect: 'login',
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login.vue'),
    meta: {
      title: 'Login',
    },
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('@/views/register.vue'),
    meta: {
      title: 'Register',
    },
  },
  {
    path: '/admin',
    name: 'admin',
    component: () => import('@/views/admin.vue'),
    meta: {
      title: 'Admin',
    },
    children: [
      {
        path: 'article',
        name: 'article',
        component: () => import('@/views/article.vue'),
        meta: {
          title: 'Article',
        },
      },
      {
        path: 'introduction',
        name: 'introduction',
        component: () => import('@/views/introduction.vue'),
        meta: {
          title: 'Introduction',
        },
      },
      {
        path: 'personnel',
        name: 'personnel',
        component: () => import('@/views/personnel.vue'),
        meta: {
          title: 'Personnel',
        },
      },
      //重定向路由
      {
        path: '/admin',
        redirect: '/admin/article',
      },
    ],
  },
]

export default routes
